package com.venutech.gongan.dto.rpc.common;

public enum InternalUserType {

    RESERVED_USER(0, "保留用户"),
    ADMIN_USER(1, "管理员用户"),
    POLICE_USER(2, "民警用户");

    private int value;
    private String typeName;

    InternalUserType(int value, String typeName) {
        this.typeName = typeName;
        this.value = value;
    }

    public static String getNameByValue(int value) {
        for (InternalUserType item : InternalUserType.values()) {
            if (item.getValue() == value) {
                return item.getTypeName();
            }
        }
        return "";
    }

    public static InternalUserType getUserTypeByValue(int value) {
        InternalUserType userType = InternalUserType.POLICE_USER;
        if (value == InternalUserType.RESERVED_USER.getValue()) {
            userType = InternalUserType.RESERVED_USER;
        } else if (value == InternalUserType.ADMIN_USER.getValue()) {
            userType = InternalUserType.ADMIN_USER;
        } else if (value == InternalUserType.POLICE_USER.getValue()) {
            userType = InternalUserType.POLICE_USER;
        }

        return userType;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
}
